import { h } from 'vue';
import { Image, Tag } from '@arco-design/web-vue';
import { BasicColumn } from '@/components/Table/index';

export const columns: BasicColumn[] = [
  {
    title: 'id',
    dataIndex: 'id',
    width: 100,
  },
  {
    title: '编码',
    dataIndex: 'no',
    width: 100,
  },
  {
    title: '名称',
    dataIndex: 'name',
    width: 100,
  },
  {
    title: '头像',
    dataIndex: 'avatar',
    width: 100,
    render({ record }) {
      return h(Image, {
        width: 48,
        style: 'width:48px;height:48px',
        src: record.avatar,
        class: 'cursor-pointer',
      });
    },
  },
  {
    title: '地址',
    dataIndex: 'address',
    width: 150,
  },
  {
    title: '开始日期',
    dataIndex: 'beginTime',
    width: 160,
  },
  {
    title: '结束日期',
    dataIndex: 'endTime',
    width: 160,
  },
  {
    title: '状态',
    dataIndex: 'status',
    width: 100,
    render(row: any) {
      return h(
        Tag,
        {
          type: row.status ? 'success' : 'error',
        },
        {
          default: () => (row.status ? '启用' : '禁用'),
        },
      );
    },
  },
  {
    title: '创建时间',
    dataIndex: 'date',
    width: 160,
  },
  {
    title: '停留时间',
    dataIndex: 'time',
    width: 80,
  },
];
